home *** CD-ROM | disk | FTP | other *** search
- ; CallFunction - call a library function via base/offset
- ;
- ; Copyright (C) 1993 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
- ;
- ; Permission to use, copy, modify, and distribute this software and its
- ; documentation for any purpose and without fee is hereby granted, provided
- ; that the above copyright notice appear in all copies and that both that
- ; copyright notice and this permission notice appear in supporting
- ; documentation. This software is provided "as is" without express or
- ; implied warranty.
- ;
- ; Declaration from C:
- ; extern __stkargs LONG CallFunction(APTR *base, LONG offset,
- ; LONG d0, LONG d1, LONG d2, LONG d3, LONG d4, LONG d5, LONG d6, LONG d7,
- ; APTR a0, APTR a1, APTR a2, APTR a3, APTR a4 );
-
- section text,code
-
- xdef _CallFunction
-
- _CallFunction:
- movem.l d2-d7/a2-a6,-(sp) ; save registers
- move.l 48(sp),a6 ; base in a6
- move.l 52(sp),a5 ; offset
- add.l a6,a5 ; base+offset in a5
- movem.l 56(sp),d0-d7/a0-a4 ; load registers
- jsr (a5) ; call library function
- movem.l (sp)+,d2-d7/a2-a6 ; restore registers
- rts
-
- END
-
-